home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / Origami / bindings / fun / go-mouse < prev    next >
Encoding:
Text File  |  1996-09-27  |  1.6 KB  |  59 lines

  1. ;OCL{{{}}}
  2. ;OCL{{{  comments
  3. ; macro that can be bound to mouse-keys to jump to the clicked position
  4. ; OCL variable ocl-argument is set to:
  5. ;  0 - no move
  6. ;  1 - y position  or buffer changed
  7. ;  2 - x position changed
  8. ;  3 - x and y/buffer position changed
  9. ;OCL}}}
  10. @if-using not(ocl-file-go-mouse)
  11.    @use (ocl-file-go-mouse)
  12.    ;OCL{{{  go-mouse-position
  13.    ( deffun go-mouse-position
  14.       ( if and(not(in-prompt) >(mouse-outside -1))
  15.          ;OCL{{{  do the move
  16.          ( set ocl-argument 0
  17.            ;OCL{{{  maybe switch buffer
  18.            if <>(current-buffer-number mouse-buffer-number)
  19.             ( goto-buffer-number mouse-buffer-number
  20.               set ocl-argument 1
  21.             )
  22.            fi
  23.            ;OCL}}}
  24.            ;OCL{{{  go up down
  25.            local
  26.             ( mouse-go-y )
  27.             (
  28.               ;OCL{{{  maybe down
  29.               while >(mouse-go-y 0)
  30.                ( set mouse-go-y -(mouse-go-y 1)
  31.                  next-line
  32.                  set ocl-argument 1
  33.                )
  34.               ;OCL}}}
  35.               ;OCL{{{  maybe up
  36.               set mouse-go-y -(0 mouse-go-y)
  37.               while >(mouse-go-y 0)
  38.                ( set mouse-go-y -(mouse-go-y 1)
  39.                  previous-line
  40.                  set ocl-argument 1
  41.                )
  42.               ;OCL}}}
  43.             )
  44.            ;OCL}}}
  45.            ;OCL{{{  go left/right
  46.            if <>(mouse-x store-pos)
  47.             ( set ocl-argument +(2 ocl-argument)
  48.               goto-counter mouse-x
  49.             )
  50.            fi
  51.            ;OCL}}}
  52.          )
  53.          ;OCL}}}
  54.         fi
  55.       )
  56.    )
  57.    ;OCL}}}
  58. @fi
  59.